package com.wwwarehouse.usercenter.fragment.register;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.alibaba.android.arouter.launcher.ARouter;
import com.wwwarehouse.common.activity.base.BaseFragment;
import com.wwwarehouse.common.tools.LogUtils;
import com.wwwarehouse.usercenter.R;
import com.wwwarehouse.usercenter.activity.RegisterCardActivity;

/**
 * Created by Jackie on 2017/8/18.
 * 注册使用的BaseFragment
 */

public class RegisterCardBaseFragment extends BaseFragment {

    public void pushFragment(Fragment fragment) {
        ((RegisterCardActivity) mActivity).pushFragment(fragment);
    }

    public void popFragment() {
        ((RegisterCardActivity) mActivity).popFragment();
    }

    public Fragment peekFragment() {
        return ((RegisterCardActivity) mActivity).peekFragment();
    }

    public void startActivity(String target, Bundle bundle, boolean finish) {
        if(target == null || "".equals(target)){
            if(LogUtils.isDebug()){
                toast(getString(R.string.arouter_mistake));
            }
            return ;
        }

        ARouter.getInstance()
                .build(target)
                .with(bundle)
                .withTransition(R.anim.comm_slide_in_from_right, R.anim.comm_scale_out)
                .navigation(mActivity);

        if (finish) {
            mActivity.finish();
        }
    }

    @Override
    public void setTitle() {

    }

    @Override
    public void requestDatas() {

    }
}
